#!/bin/bash

CMD="./administrativedivision"
URL=""
PADDING=false
if [ $# -ge 1 ]; then
  URL=$1
fi

if [ "a$URL" = "a" ]; then
  echo "please type the url file(.html)"
  exit 1
fi

OUTPUT=$2

[ -d "$OUTPUT" ] || mkdir -p $OUTPUT

$CMD -url=$URL -format=json -padding=$PADDING > $OUTPUT/cityCode.json
$CMD -url=$URL -format=plist -padding=$PADDING > $OUTPUT/cityCode.plist
$CMD -url=$URL -format=xml -padding=$PADDING > $OUTPUT/cityCode.xml
